//
//  HomeCollectionViewCell.m
//  YaDiuDiu
//
//  Created by 陈刚 on 2017/10/23.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "HomeCollectionViewCell.h"

@interface HomeCollectionViewCell ()

@end

@implementation HomeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
        
        [self addConstraint];
    }
    return self;
}

- (void)setupView{
    self.timeLabel = [[UILabel alloc] init];
    self.timeLabel.text = @"10:00";
    self.timeLabel.textColor = HexColorInt32_t(555555);
    self.timeLabel.font = [UIFont systemFontOfSize:18.0];
    [self.timeLabel setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:self.timeLabel];
    
    self.statusLabel = [[UILabel alloc] init];
    self.statusLabel.text = @"即将开始";
    self.statusLabel.textColor = HexColorInt32_t(555555);
    self.statusLabel.font = [UIFont systemFontOfSize:12.0];
    [self.statusLabel setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:self.statusLabel];
}

- (void)addConstraint{
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(0);
        make.left.equalTo(0);
        make.right.equalTo(0);
        make.height.equalTo(30);
    }];
    
    [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(30);
        make.left.equalTo(0);
        make.right.equalTo(0);
        make.height.equalTo(20);
    }];
}

- (void)setItemData:(NSDictionary *)item{
    NSString *timeString = [item objectForKey:@"starttime"];
     timeString = [timeString substringToIndex:[timeString length] - 3];
    [self.timeLabel setText:timeString];
}

@end
